/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.treinamento.collections.comparableComparator;

import java.util.Comparator;

/**
 *
 * @author felipe
 */
public class ItemMaiorNomeComparator implements Comparator<Item> {

    @Override
    public int compare(Item itemA, Item itemB) {
        String nomeA = itemA.getDescricao();
        String nomeB = itemB.getDescricao();
        
        if(nomeA.length() == nomeB.length()){
            return 0;
        }else if(nomeA.length() > nomeB.length()){
            return 1;
        }else {
            return -1;
        }
    }
    
}
